check_cxx_compiler_flag(-mavx512fp16 COMPILER_SUPPORTS_FP16)
if(CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES AppleClang)
    if(COMPILER_SUPPORTS_FP16)
        set(fp16_ex5_srcs fast_special_min.cpp)
        set_property(SOURCE ex5_test.cpp APPEND PROPERTY COMPILE_OPTIONS "-DCOMPILER_SUPPORTS_FP16")
        set_property(SOURCE fast_special_min.cpp APPEND PROPERTY COMPILE_OPTIONS "-mavx512f" "-mavx512vl" "-mavx512fp16")
    endif()
else()
    set(fp16_ex5_srcs fast_special_min.cpp)
    set_property(SOURCE ex5_test.cpp APPEND PROPERTY COMPILE_OPTIONS "/DCOMPILER_SUPPORTS_FP16")
endif()
add_executable(fp16_ex5_tests ex5_test.cpp ${fp16_ex5_srcs})
target_link_libraries(fp16_ex5_tests gtest_main optimisation_common)

add_test(NAME fp16_ex5_test COMMAND fp16_ex5_tests)
